requiredFields = document.getElementsByClassName('req');
$(document).ready(function() {
	$('.agregar-cosa').click(function() {
		 for(i=0; i<requiredFields.length;i++){
			 $(requiredFields[i]).addClassName('form-error');
		 }
		});
	});

});/*
	 * <script type="text/javascript"> // Look for all req fields and put them
	 * in an array requiredFields = document.getElementsByClassName('req'); //
	 * Loop the array and place observers on the req fields for(i=0; i<requiredFields.length;i++){
	 * new Form.Element.Observer(requiredFields[i], 2, liveActionCallback); } //
	 * Callback if something happens in one of the req fields function
	 * liveActionCallback( element, value ) { // Funcion for handling the
	 * response XML file wich the Ajax.Request below gets for us var handlerFunc =
	 * function(t) { var xmlDoc = t.responseXML.documentElement; // Check if
	 * there is an error
	 * if(xmlDoc.getElementsByTagName('error')[0].firstChild.nodeValue == '1'){ //
	 * You could do all kinds of stuff here, i'm just adding a classname to the
	 * form field wich makes it red $(element).addClassName('form-error'); }
	 * else { // if there is no error, remove the req class
	 * $(element).removeClassName('req'); } }
	 *  // Create a new ajax request, note the .xml added to the url, it makes
	 * shure we get an xml back from the controller.
	 * 
	 * new Ajax.Request('/regwiz/customer.xml', { asynchronous:true,
	 * evalScripts:true, parameters:Form.Element.serialize(element),
	 * onSuccess:handlerFunc } ); } </script>
	 */